package org.acra;

import android.app.Application;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.preference.PreferenceManager;
import org.acra.c.b;

public class ACRA
{
  public static final boolean DEV_LOGGING = false;
  public static final String LOG_TAG = ACRA.class.getSimpleName();
  public static final String PREF_ALWAYS_ACCEPT = "acra.alwaysaccept";
  public static final String PREF_DISABLE_ACRA = "acra.disable";
  public static final String PREF_ENABLE_ACRA = "acra.enable";
  public static final String PREF_ENABLE_DEVICE_ID = "acra.deviceid.enable";
  public static final String PREF_ENABLE_SYSTEM_LOGS = "acra.syslog.enable";
  public static final String PREF_LAST_VERSION_NR = "acra.lastVersionNr";
  public static final String PREF_USER_EMAIL_ADDRESS = "acra.user.email";
  private static c configProxy;
  private static ErrorReporter errorReporterSingleton;
  public static org.acra.c.a log = new b();
  private static Application mApplication;
  private static SharedPreferences.OnSharedPreferenceChangeListener mPrefListener;
  private static org.acra.a.a mReportsCrashes;

  static void checkCrashResources()
  {
    c localc = getConfig();
    switch (b.a[localc.q().ordinal()])
    {
    default:
    case 1:
    case 2:
    case 3:
    }
    do
    {
      do
      {
        do
          return;
        while (localc.B() != 0);
        throw new d("TOAST mode: you have to define the resToastText parameter in your application @ReportsCrashes() annotation.");
      }
      while ((localc.z() != 0) && (localc.A() != 0) && (localc.y() != 0) && (localc.v() != 0));
      throw new d("NOTIFICATION mode: you have to define at least the resNotifTickerText, resNotifTitle, resNotifText, resDialogText parameters in your application @ReportsCrashes() annotation.");
    }
    while (localc.v() != 0);
    throw new d("DIALOG mode: you have to define at least the resDialogText parameters in your application @ReportsCrashes() annotation.");
  }

  public static SharedPreferences getACRASharedPreferences()
  {
    c localc = getConfig();
    if (!"".equals(localc.D()))
      return mApplication.getSharedPreferences(localc.D(), localc.C());
    return PreferenceManager.getDefaultSharedPreferences(mApplication);
  }

  static Application getApplication()
  {
    return mApplication;
  }

  public static c getConfig()
  {
    if (configProxy == null)
    {
      if (mApplication == null)
        log.b(LOG_TAG, "Calling ACRA.getConfig() before ACRA.init() gives you an empty configuration instance. You might prefer calling ACRA.getNewDefaultConfig(Application) to get an instance with default values taken from a @ReportsCrashes annotation.");
      configProxy = getNewDefaultConfig(mApplication);
    }
    return configProxy;
  }

  public static ErrorReporter getErrorReporter()
  {
    if (errorReporterSingleton == null)
      throw new IllegalStateException("Cannot access ErrorReporter before ACRA#init");
    return errorReporterSingleton;
  }

  public static c getNewDefaultConfig(Application paramApplication)
  {
    if (paramApplication != null)
      return new c((org.acra.a.a)paramApplication.getClass().getAnnotation(org.acra.a.a.class));
    return new c(null);
  }

  public static void init(Application paramApplication)
  {
    if (mApplication != null)
    {
      log.b(LOG_TAG, "ACRA#init called more than once. Won't do anything more.");
      return;
    }
    mApplication = paramApplication;
    mReportsCrashes = (org.acra.a.a)mApplication.getClass().getAnnotation(org.acra.a.a.class);
    if (mReportsCrashes == null)
    {
      log.c(LOG_TAG, "ACRA#init called but no ReportsCrashes annotation on Application " + mApplication.getPackageName());
      return;
    }
    SharedPreferences localSharedPreferences = getACRASharedPreferences();
    try
    {
      checkCrashResources();
      log.a(LOG_TAG, "ACRA is enabled for " + mApplication.getPackageName() + ", intializing...");
      if (!shouldDisableACRA(localSharedPreferences));
      for (boolean bool = true; ; bool = false)
      {
        ErrorReporter localErrorReporter = new ErrorReporter(mApplication.getApplicationContext(), localSharedPreferences, bool);
        localErrorReporter.d();
        errorReporterSingleton = localErrorReporter;
        mPrefListener = new a();
        localSharedPreferences.registerOnSharedPreferenceChangeListener(mPrefListener);
        return;
      }
    }
    catch (d locald)
    {
      while (true)
        log.a(LOG_TAG, "Error : ", locald);
    }
  }

  static boolean isDebuggable()
  {
    PackageManager localPackageManager = mApplication.getPackageManager();
    try
    {
      int i = localPackageManager.getApplicationInfo(mApplication.getPackageName(), 0).flags;
      int j = i & 0x2;
      boolean bool = false;
      if (j > 0)
        bool = true;
      return bool;
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
    }
    return false;
  }

  public static void setConfig(c paramc)
  {
    configProxy = paramc;
  }

  public static void setLog(org.acra.c.a parama)
  {
    log = parama;
  }

  private static boolean shouldDisableACRA(SharedPreferences paramSharedPreferences)
  {
    boolean bool1 = true;
    try
    {
      if (!paramSharedPreferences.getBoolean("acra.enable", true));
      while (true)
      {
        boolean bool2 = paramSharedPreferences.getBoolean("acra.disable", bool1);
        return bool2;
        bool1 = false;
      }
    }
    catch (Exception localException)
    {
    }
    return false;
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     org.acra.ACRA
 * JD-Core Version:    0.6.2
 */